class_name GameplayAbility
## Gameplay Ability
## Version: 0.1.0

## 能力是否激活
var active: bool = true

## 能力的资源类
var ability_asset: GameplayAbilityAsset

## 能力的拥有者
var owner: AbilitySystemComponent

##
var level: int


func _init(init_ability_asset: GameplayAbilityAsset, init_owner: AbilitySystemComponent) -> void:
	ability_asset = init_ability_asset
	owner = init_owner
	
	on_owner_set()


func on_owner_set() -> void:
	_on_owner_set()


func can_apply() -> bool:
	return active and _can_apply()


func on_update(delta: float) -> void:
	_on_update(delta)


func create_spec(target: AbilitySystemComponent) -> GameplayAbilitySpec:
	return _create_spec(target)


#region Need to override
func _on_owner_set() -> void:
	pass


func _can_apply() -> bool:
	return true


func _on_update(_delta: float) -> void:
	pass


func _create_spec(target: AbilitySystemComponent) -> GameplayAbilitySpec:
	return GameplayAbilitySpec.new(self, target)
#endregion
